/*******************************************************************************
 ** Government Sanctioned Espionage RPG                                       **
 ** http://www.government-sanctioned.us/                                      **
 **===========================================================================**
 ** Name: object.cpp                                                          **
 ** Description: Base class for world objects.                                **
 **                                                                           **
 ** Open Source Initiative (OSI) Approved License                             **
 **                                                                           **
 ** The contents of this file are subject to the terms of the                 **
 ** Common Development and Distribution License, Version 1.0 only             **
 ** (the "License").  You may not use this file except in compliance          **
 ** with the License.                                                         **
 **                                                                           **
 ** You can find a copy of the license in the LICENSE file within             **
 ** this distribution or at $WIKI/display/GOVT/License-software.              **
 ** Software distributed under the License is distributed on an "AS IS"       **
 ** basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.           **
 ** See the License for the specific language governing permissions           **
 ** and limitations under the License.                                        **
 **                                                                           **
 ** When distributing Covered Code, include this CDDL header in each          **
 ** file and include the License file at $GAME_DIR/LICENSE.                   **
 ** If applicable, add the following below this header, with the indicated    **
 ** fields enclosed by brackets "[]" replaced with your own identifying       **
 ** information: Portions Copyright [yyyy] [name of copyright owner]          **
 **                                                                           **
 ** Copyright (c) 2009-2012  Barry Gian James <gian@gamingods.net>            **
 ** All rights reserved.                                                      **
 ******************************************************************************/
// Modified $Date$ by $Author$
#define _object_cpp_ID    "$Id$"

#include <cstring>
#include "object.hpp"
#include "uuid.hpp"


// Moved from using ID to using UUID for uniqueness tests 5.12.11 -gian
bool operator < (WorldObject & a, WorldObject & b)
{
//    return a.ID() < b.ID();
	return a.UUID() < b.UUID();
}

// Not sure if this should compare object ID's or string compare names?
bool operator == (WorldObject & a, WorldObject & b)
{
//    return a.ID() == b.ID();
	return a.UUID() == b.UUID();
}

/////////////////////////////////[ WorldObject
bool
WorldObject::IsAdjective(const std::string & s)
{
	std::vector<std::string>::const_iterator	i;
	for (i = _adj.begin(); i != _adj.end(); i++)
	{
		if ((*i) == s)
			return true;
	}
	return false;
}

bool
WorldObject::IsAKA(const std::string & s)
{
	std::vector<std::string>::const_iterator	i;
	for (i = _aka.begin(); i != _aka.end(); i++)
	{
		if ((*i) == s)
			return true;
	}
	return false;
}

//void
//WorldObject::AddAttribute(const std::string & a, const std::string & v)
//{
//	attr[a] = v;
//}


//constructor
WorldObject::WorldObject(ObjectType tt, const std::string & n, const std::string & t)
{
    _type = tt;
	_name = n;
	_tag = t;
    _weight = WEIGHT_UNLIFTABLE;
	_slots = 1;
	uuid_ = global::UUIDFactory::Create();

    _x = _y = 0;
}

WorldObject::WorldObject(void)
{
    _type = ObjectType::Unknown;
    _weight = WEIGHT_UNLIFTABLE;
	_name = "<UNKNOWN>";
	_tag = "<NOT SET>";
	uuid_ = global::UUIDFactory::Create();

    _x = _y = 0;
}

//destructor
WorldObject::~WorldObject(void)
{

}


